Live Regex Tester
Enter a regular expression and a string to see what matches.
Matches
Capturing Groups:
Explore the power of regex patterns.
Enter a regular expression and a string to see what matches.
Capturing Groups:
// Capturing Group & Backreference /(hi)\s\1/ // Matches "hi hi" // Named Capturing Group & Backreference /(?<word>hi)\s\k<word>/ // Matches "hi hi" // Character Class & Quantifier /[a-zA-Z]+/ // Matches one or more letters // Lookahead & Lookbehind /\w+(?=,)/ // Matches a word only if followed by a comma
Below are more examples of common patterns and what they match.
`/\bcat\b/` (Word Boundary)
Matches: `The cat sat.` -> `cat`
Does NOT Match: `category`
`/[^aeiouAEIOU]/g` (Negated Character Class)
Matches: `JavaScript` -> `J, v, s, c, r, p, t`
`/(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}/` (Lookaheads & Quantifier)
Checks if a string has at least one lowercase letter, one uppercase letter, one digit, and is 8 characters or more. `Password123` would match.